package com.stark.wechat.service.menu.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 获取自定义菜单配置返回体
 *
 * @author <a href="mengbin@eastsoft.com.cn">Ben</a>
 * @version 1.0.0
 * @see <a href="https://developers.weixin.qq.com/doc/service/api/custommenu/api_getmenu.html#%E8%BF%94%E5%9B%9E%E4%BD%93-Response-Payload">自定义菜单 / 获取自定义菜单配置</a>
 * @since 2025/8/6
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetMenuResponsePayload implements Serializable {

    private static final long serialVersionUID = -2683104504461561380L;

    /**
     * 默认菜单信息
     */
    private Menu menu;

    /**
     * 个性化菜单列表
     */
    private List<Conditionalmenu> conditionalmenu = new ArrayList<>();

    /**
     * 默认菜单信息
     */
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Menu implements Serializable {

        private static final long serialVersionUID = 7144236268883543188L;

        /**
         * 一级菜单数组(1-3个)
         */
        private List<Button> button = new ArrayList<>();

        /**
         * 菜单ID
         */
        private String menuid;

    }

    /**
     * 个性化菜单
     */
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Conditionalmenu implements Serializable {

        private static final long serialVersionUID = -1529750950603560417L;

        /**
         * 一级菜单数组(1-3个)
         */
        private List<Button> button = new ArrayList<>();

        /**
         * 菜单匹配规则(至少一个非空字段)
         */
        private Matchrule matchrule;

        /**
         * 菜单ID
         */
        private String menuid;

    }

}
